Web Services

Common Functions

Method Name Parameter Return Type Usage Example
getPropValues fileName: String HashMap<String, Object> To read the property file values GetProp getPropertiesInMap = new GetProp(); propMap = getPropertiesInMap.getPropValues(filename);
getFilePath fileName: String String To get file path String requestFilePath = GetProp.getFilePath(filename);
setJsonbody fileName: String void To set json body for post,delete,put and update methods RequestParams Attwrapper = new RequestParams(); Attwrapper.setJsonbody(fileName);
CreateRequest raWrapper: RequestParams raWrapper RequestSpecification To create request by fetching values from property file RestAssuredWrapper raWrapper = new RestAssuredWrapper(); raWrapper.setAPIFileProName(fileName); RequestSpecification reqSpec = raWrapper.CreateRequest(Attwrapper);
setAPIFileProName fileName: String void To set Api property file name RestAssuredWrapper raWrapper = new RestAssuredWrapper(); raWrapper.setAPIFileProName(fileName);
ConvertObjectToMap raWrapper: RequestParams Map<String, Object>/td> To convert object to map ObjMap = ConvertObjectToMap(raWrapper);
sendRequest methodType : String,reqSpec :RequestSpecification (MethodType : Get, Put, Post) void To send request RequestParams Attwrapper = new RequestParams(); RestAssuredWrapper raWrapper = new RestAssuredWrapper(); raWrapper.setAPIFileProName("sampleGETApi.properties"); RequestSpecification reqSpec = raWrapper.CreateRequest(Attwrapper); raWrapper.sendRequest(methodType,reqSpec);
sendGetRequestWithParams reqSpec : RequestSpecification void To send get request with parameters RequestParams Attwrapper = new RequestParams(); RestAssuredWrapper raWrapper = new RestAssuredWrapper(); RequestSpecification reqSpec = raWrapper.CreateRequest(Attwrapper); raWrapper.sendGetRequestWithParams(reqSpec);
valResponseCode responseCode :int void To verify the response code in respose body raWrapper.valResponseCode(responsecode);
valJsonResponseVal jsonPath : String, expValue: Object void To verify the response value in json respose path raWrapper.valJsonResponseVal(jsonPath,expValue);
valXmlResponseVal xmlPath : String, expValue: Object void To verify the response value in xml respose path raWrapper.valXmlResponseVal(xmlPath,expValue)
setGetQueryParams params :HashMap<String, String> void To set get query parameters RequestParams Attwrapper = new RequestParams(); RestAssuredWrapper raWrapper = new RestAssuredWrapper(); raWrapper.setAPIFileProName(fileName); HashMap params = new HashMap(); params.put("q", "London"); params.put("APPID", "b110aef38de749c461af939ba52cb6f4"); params.put("mode", "xml"); raWrapper.setGetQueryParams(params);
createSOAPRequest fileName :String SOAPMessage To create soap request
callSoapWebService soapMessage :SOAPMessage,soapEndpointUrl:String SOAPMessage
getNodeValue doc :Document,locator:String String
getStatusCode soapMessage :SOAPMessage String
getDocumentObject soapMsg :SOAPMessage Document
parseResponse xmlData :String Document
writeToFile xmlDoc :Document,fileName:String void